package cn.snmp.mutual.nms;

public class SnmpNull extends SnmpVar
{
    int value;
    byte[] byteValue;
    
    public SnmpNull() {
        this.value = 0;
        this.Type = 5;
    }
    
    public SnmpNull(final byte byte0) {
        this.value = 0;
        this.Type = 5;
        this.varbindErrorVal = byte0;
    }
    
    @Override
    int encode(final byte[] bytes, final int i) throws ArrayIndexOutOfBoundsException {
        if (this.varbindErrorVal == 0) {
            return ASNTypes.encodeNull(bytes, i, 5);
        }
        return ASNTypes.encodeNull(bytes, i, this.varbindErrorVal);
    }
    
    @Override
    public Object getVarObject() {
        return this.toValue();
    }
    
    @Override
    public byte[] toBytes() {
        return null;
    }
    
    @Override
    public String toString() {
        return "NULL";
    }
    
    @Override
    public String toTagString() {
        String s = null;
        if (this.Type == 2) {
            s = "INTEGER : ";
        }
        if (this.Type == 4) {
            s = "STRING : ";
        }
        if (this.Type == 6) {
            s = "OBJID : ";
        }
        if (this.Type == 5) {
            s = "NULLOBJ : ";
        }
        if (this.Type == 64) {
            s = "IPADDRESS : ";
        }
        if (this.Type == 65) {
            s = "COUNTER : ";
        }
        if (this.Type == 66) {
            s = "GAUGE : ";
        }
        if (this.Type == 67) {
            s = "TIMETICKS : ";
        }
        if (this.Type == 68) {
            s = "OPAQUE : ";
        }
        return s + "NULL";
    }
    
    @Override
    public Object toValue() {
        return null;
    }
}
